<template>
  <div class="question_cell">
    <nuxt-link class="ask" :to="`/question/${info.id}`">
      <div class="icon">
        <img src="@/assets/images/question/ask.png" alt="" />
      </div>
      <span class="title">{{ info.question }}</span>
    </nuxt-link>
    <div class="ask answer">
      <div class="icon">
        <!-- <img src="@/assets/images/question/answer.png" alt="" /> -->
      </div>
      <div class="van-multi-ellipsis--l2 txt">
        {{ info.introduce }}{{ info.introduce }}{{ info.introduce }}
      </div>
    </div>
    <div class="footer">
      <div class="time">{{ showTime(info.questionTime) }}</div>
      <div class="total">
        <img src="@/assets/images/question/browse.png" alt="" />
        <span>{{ info.initReadCnt }}</span>
      </div>
    </div>
  </div>
</template>
<script>
import moment from "moment";
export default {
  name: "Question",
  props: {
    info: {
      type: Object,
      default: function () {
        return {};
      },
    },
  },
  data() {
    return {};
  },
  methods: {
    // 查看详情
    lookDetail() {
      let o = this.info;
      let query = this.$route.query;
      query.id = o.id;
      this.$router.push({
        path: "/question/detail",
        query: { ...query },
      });
    },

    // 格式化时间
    showTime(str) {
      if (!str) {
        return "";
      }
      let o = moment(str).format("YYYY-MM-DD");
      return o;
    },
  },
};
</script>
<style lang="less" scoped>
@import "./index.less";
</style>